import {Component, Input, OnInit} from '@angular/core';
import {DateTimeAdapter, OWL_DATE_TIME_FORMATS, OWL_DATE_TIME_LOCALE, OwlDateTimeFormats} from 'ng-pick-datetime';
import {MomentDateTimeAdapter} from 'ng-pick-datetime-moment';

export const INPUT_DATE_TIME_FORMATS: OwlDateTimeFormats = {
    parseInput: 'YYYY-MM-DD HH:mm:ss',
    datePickerInput: 'YYYY-MM-DD',
    fullPickerInput: 'YYYY-MM-DD HH:mm',
    timePickerInput: 'HH:mm',
    monthYearLabel: 'MMM YYYY',
    dateA11yLabel: 'LL',
    monthYearA11yLabel: 'MMMM YYYY',
};

@Component({
    selector: 'app-input-data-time',
    templateUrl: './input-data-time.component.html',
    styleUrls: ['./input-data-time.component.css'],
    providers: [
        {provide: DateTimeAdapter, useClass: MomentDateTimeAdapter, deps: [OWL_DATE_TIME_LOCALE]},
        {provide: OWL_DATE_TIME_FORMATS, useValue: INPUT_DATE_TIME_FORMATS},
    ],
})
export class InputDataTimeComponent implements OnInit {

    @Input('field')
    field: {
        icon: any,
        nickname: string,
        value: () => string,
        focus: (event) => {},
        blur: (event) => {}
    };

    constructor() {
    }

    ngOnInit() {
    }

}
